define(['vue','common'],function (Vue,common){
    const Controller = {
        index:function (){
            let {createApp} = Vue;
            let app = createApp({
                data(){
                    return {
                        //列表数据
                        listObj:{
                            page:1,
                            limit:10,
                            total:0,
                            list:[]
                        },
                        //搜索条件
                        search:{
                            list:[],
                            form:{
                                filter:[],
                                op:[],
                                list_type:"tree",
                                pk:"id",
                                sort:'id',
                                order:"desc"
                            }
                        },
                        //批量选择
                        selectables:[]
                    }
                },
                created(){
                    this.getList()
                },
                methods:{
                    ...common,
                    selectable(row){
                        return row.id!=1
                    }
                }
            })
            common.load(app,['icon'])
            app.mount('#app')
        },
        add:function (){
            let {createApp} = Vue;
            let app = createApp({
                data(){
                    return {
                        form:{
                            pid:"",
                            name:"",
                            rules:[],
                            status:1
                        },
                        rules:{

                        },
                        options:{
                            pidList:[],
                            rulesList:[],//权限列表
                        }
                    }
                },
                created() {
                    this.options.pidList = Config.pidList
                    this.options.rulesList = Config.menuList
                },
                methods:{
                    ...common
                }
            })
            common.load(app,['icon','MuTreeSelect','MuCascader'])
            app.mount('#app')
        },
        edit:function (){
            let {createApp} = Vue;
            let app = createApp({
                data(){
                    return {
                        form:{
                            pid:"",
                            name:"",
                            rules:[[1,13]],
                            status:1
                        },
                        rules:{

                        },
                        options:{
                            pidList:[],
                            rulesList:[],//权限列表
                        }
                    }
                },
                created() {
                    this.options.pidList = Config.pidList
                    this.options.rulesList = Config.menuList
                    this.form  = common.addObject(this.form,Config.row)
                    // console.log(this.form,'fffffffffffff')
                },
                methods:{
                    ...common
                }
            })
            common.load(app,['icon','MuTreeSelect','MuCascader'])
            app.mount('#app')
        }
    }
    return Controller;
})